function string.split(str, delimiter)
        if str==nil or str=='' or delimiter==nil then
                return nil
        end

    local result = {}
    for match in (str..delimiter):gmatch("(.-)"..delimiter) do
        table.insert(result, match)
    end
    return result
end

local key = KEYS[1]

local result = {}

for i,v in ipairs(ARGV) do
    if (v ~= nil and v ~= "") then
        local args = string.split(v, ":")
        local isrepeat = 0
        if (args ~= nil) then
            for j,n in ipairs(args) do
                local index = redis.call("zrank", key, n)
                if (index) then 
                    isrepeat = 1
                    break
                end
            end
        end
        if (isrepeat == 1) then
            table.insert(result, 1)
        else
            table.insert(result, 0)
        end 
    else
        table.insert(result, 0)
    end
end

return result
